const Authority = require('../models/authority_model')
const jsonResult = require('../utils/JSON')

// 权限-获取管理员列表
exports.authorityListGet = async (ctx,next) => {
    try {
        let { body } = ctx.request.body;
        console.log(body);
        let res = await Authority.authorityListGet(body);
        console.log(res,"authorityListGet");
        ctx.body = jsonResult.resultSuccessJson(undefined, undefined,res)
    } catch (error) {
        console.log(error)
        ctx.body = jsonResult.resultErrorJson(undefined, undefined);
    }
}

// 权限-修改管理员信息
exports.authorityUpdate = async (ctx)=>{
    try{
        let { body } = ctx.request.body;
        let res = await Authority.authorityUpdate(body);
        ctx.body = jsonResult.resultSuccessJson(undefined, undefined,res); 
    }catch(error){
        console.log(error);
        ctx.body = jsonResult.resultErrorJson(undefined, undefined);
    }
}